package com.yssoft.controller.supervise;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yssoft.service.core.AreaService;
import com.yssoft.service.core.ProductClassifyService;
import com.yssoft.service.production.LabelApplyService;

/**
 * @类名称: SuperviseLabelController
 * @类描述: 监管标签查询控制器
 * @作者: 王永宁
 * @创建时间:2018年6月12日 下午1:19:50
 */
@Controller
@RequestMapping("/supervise/label")
public class SuperviseLabelController {

    @Autowired
    private ProductClassifyService productClassifyService;
    
    @Resource
    private AreaService areaService;
    
    @Resource
    private LabelApplyService labelApplyService;
    
	
    /**
     * 跳转到标签查询监管页面
     * @return
     */
    @RequestMapping("/labelPage")
    public String labelPage(Model model) {
    	List<Map<String, Object>> jsonArray = productClassifyService.queryProClaTree();
        String areaTree = areaService.queryAreaTree();
        model.addAttribute("mJson", JSONArray.toJSON(jsonArray));
        model.addAttribute("areaTree", areaTree);
        return "supervise/label/labelList";
    }
    
    /**
     * 获取监管标签查询数据
     * 王永宁
     */
    @RequestMapping("/findLabelPage")
    @ResponseBody
    public JSONObject findLabelPage(@RequestParam(name = "page", defaultValue = "0") int page, @RequestParam(name = "limit", defaultValue = "10") int limit,String area,String mType,String companyId,String productName,String suyuan) {
    	JSONObject jsonObject = labelApplyService.queryLabelPageForSupervise(page,limit,area,mType,companyId,productName,suyuan);
        return jsonObject;
    }

}
